home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / util / pack / xfdmaster.lha / xfd / Developer / Sources / ASM / ImploderClone.a < prev    next >
Text File  |  1999-02-05  |  2KB  |  115 lines

  1. ***************************************************************
  2. **   XFD external decruncher for recognising the Imploder    **
  3. **    Hack as used on the PC Task executables.             **
  4. ***************************************************************
  5.  
  6.         opt o+,ow2-,c-
  7.  
  8.         SECTION    ImploderHack,CODE
  9.  
  10.         Incdir    Inx:
  11.         Include    Inx:xfdmaster.I
  12.         Include    Inx:Macros.I
  13.         Include    Inx:LVO.Gs
  14.  
  15. ; xfdForeman structure MUST be first thing in all external decrunchers
  16.  
  17. F_ImploderHack    moveq    #-1,d0            ;security
  18.         rts
  19.  
  20.         dc.l    XFDF_ID_EQU        ;id
  21.         dc.w    1            ;version
  22.         dc.w    0
  23.         dc.l    0,0            ;private
  24.         dc.l    S_ImploderHack        ;first slave
  25.  
  26. **************************************************
  27.  
  28. ; xfdSlave structure: this one doesn't support segment decrunching
  29.  
  30. S_ImploderHack    dc.l    0            ;no more slaves
  31.         dc.w    1            ;version
  32.         dc.w    33            ;master version
  33.         dc.l    N_ImploderHack        ;name
  34.         dc.w    XFDPFF_RELOC        ;flags
  35.         dc.w    0
  36.         dc.l    RB_ImploderHack        ;recog buffer
  37.         dc.l    DB_ImploderHack        ;decrunch buffer
  38.         dc.l    0            ;recog segment
  39.         dc.l    0            ;decrunch segment
  40.  
  41. N_ImploderHack    dc.b    'Imploder Clone',0
  42.         even
  43.  
  44. ;-------------------------------------------------
  45.  
  46. ; Recog buffer function: receives buffer + length in a0/d0
  47.  
  48. RB_ImploderHack    Moveq.l    #1,d0            ; True
  49.         Cmp.l    #$3f3,(a0)+        ; Is this an executable?
  50.         Bne.b    .No
  51.  
  52.         Move.l    4(a0),d1
  53.         Add.l    d1,d1
  54.         Add.l    d1,d1            ; x4
  55.         Add.l    d1,a0
  56.         Lea    4*4(a0),a0        ; Skip the first/last hunk numbers,
  57.                         ; and 
  58.  
  59.         Cmp.l    #$3e9,(a0)
  60.         bne.b    .No
  61.  
  62.         Cmp.l    #$48e7ffff,8(a0)    ; This is on all IMPLODER files
  63.         Bne.b    .No
  64.  
  65.         Cmp.l    #$7cff4486,12(a0)    ; Moveq.l #-1,d6
  66.         Bne.b    .No
  67.  
  68.         Cmp.l    #$49fa005a,16(a0)    ; Neg d6
  69.         Beq.b    .Yes
  70.  
  71.  
  72. .No        Moveq.l    #0,d0
  73. .Yes        rts
  74.  
  75. ;-------------------------------------------------
  76.  
  77. ;Decrunch buffer function: receives bufferinfo in a0
  78.  
  79. DB_ImploderHack    PushM    d2-d7/a2-a6
  80.         move.l    a0,a5
  81.  
  82.         Move.l    xfdbi_SourceBufLen(a5),d0
  83.         move.l    d0,xfdbi_TargetBufSaveLen(a5)
  84.         move.l    d0,xfdbi_TargetBufLen(a5)
  85.  
  86.         move.l    xfdbi_TargetBufMemType(a5),d1
  87.         move.l    4.w,a6
  88.         Call    AllocMem
  89.         moveq    #XFDERR_NOMEMORY,d1
  90.         Move.w    d1,xfdbi_Error(a5)
  91.         move.l    d0,xfdbi_TargetBuffer(a5)
  92.         beq.b    .NoMem
  93.  
  94.         Clr.w    xfdbi_Error(a5)
  95.  
  96.         Move.l    d0,a1
  97.         Move.l    xfdbi_SourceBuffer(a5),a0
  98.         Move.l    xfdbi_SourceBufLen(a5),d0
  99.         Call    CopyMem
  100.  
  101.         move.l    xfdbi_TargetBuffer(a5),a0
  102. .SeekStart    Cmp.l    #$3e9,(a0)+
  103.         Bne.b    .SeekStart
  104.  
  105.         Move.l    #$49fa005e,8(a0)
  106.         Move.l    #$3c3c0002,12(a0)
  107.  
  108.         Moveq.l    #1,d0        ; True = Decrunched ok
  109. .NoMem        PopM    d2-d7/a2-a6
  110.         Rts
  111.  
  112. **************************************************
  113.  
  114.         END
  115.